<template>
  <div>
    <Chart :cdata="cdata" />
  </div>
</template>

<script>
import Chart from './chart.vue';
export default {
  data() {
    return {
      xValue:[],
      cdata: {
        xData: [],
        seriesData: [
          { value: 10, name: "data1" },
          { value: 5, name: "data2" },
          { value: 15, name: "data3" },
          { value: 25, name: "data4" },
          { value: 20, name: "data5" },
          { value: 35, name: "data6" }
        ]
      }
    }
  },
  components: {
    Chart,
  },
  created() {
    this.cdata.xData = this.$store.state.initData.shangxinxi.map(element => {
      return element.leibie
    })
    this.cdata.xData = this.cdata.xData.slice(0, 6)

    this.xValue = this.$store.state.initData.shangxinxi.map(element => {
      return element.number
    })
    this.xValue = this.xValue.slice(0, 6)

    for (let i = 0; i < this.cdata.seriesData.length; i++) {
      this.cdata.seriesData[i].name = this.cdata.xData[i]
      this.cdata.seriesData[i].value = this.xValue[i]
    }
  },
  mounted() {
  },
  methods: {
  }
}
</script>

<style lang="scss" scoped></style>